Skip to content

fix: allow empty container's types to be lazily resolved - #12

Merged
Ahajha merged 1 commit into
mainfrom
trotta/fix-allow-empty-container-s-types-to-be-lazily-resolved
Oct 26, 2026
Merged

Ahajha merged 1 commit into
mainfrom
trotta/fix-allow-empty-container-s-types-to-be-lazily-resolved

Conversation

@Ahajha

@Ahajha Ahajha commented Oct 26, 2026

Copy link
Copy Markdown
Member

Expressions such as [] + [1] would resolve to list[Unknown | int], which is a bit annoying. Worse, you could get warnings when doing even more logic on this, like passing to a rule which expects a list[int].

When constructing empty containers, we now use a separate placeholder EmptyUnspecified, which allows us to nicely merge these types with other ones.

This also handles dicts and tuples in similar ways, though they're a bit more compilated since there are multiple elements.

Expressions such as `[] + [1]` would resolve to `list[Unknown | int]`, which is a bit annoying. Worse, you could get warnings when doing even more logic on this, like passing to a rule which expects a `list[int]`.

When constructing empty containers, we now use a separate placeholder `EmptyUnspecified`, which allows us to nicely merge these types with other ones.

This also handles dicts and tuples in similar ways, though they're a bit more compilated since there are multiple elements.
@Ahajha
Ahajha marked this pull request as ready for review October 26, 2026 15:26
@Ahajha
Ahajha merged commit 70db18c into main Oct 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant